<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8" />
		<title>5.键盘事件</title>
		<!-- 引入Vue -->
		<script type="text/javascript" src="../js/vue.js"></script>
	</head>
	<body>
		<!-- 准备好一个容器-->
		<div id="demo">
			<h2>欢迎来到{{school}}</h2>
			<!-- 通过按键编码识别回车 -->
			<!-- <input @keyup.13="showText" type="text" placeholder="按下回车键提示输入" > <br> -->

			<!-- 通过按键别名识别回车 -->
			<input @keyup.enter="showText" type="text" placeholder="按下回车键提示输入" > <br>
			<input @keyup.delete="showText" type="text" placeholder="按下删除键提示输入" > <br>
			<input @keyup.esc="showText" type="text" placeholder="按下esc键提示输入" > <br>
			<input @keyup.space="showText" type="text" placeholder="按下空格键提示输入" > <br>
			<input @keydown.tab="showText" type="text" placeholder="按下tab键提示输入" > <br>
			<input @keyup.up="showText" type="text" placeholder="按↑键提示输入" > <br>
			<input @keyup.down="showText" type="text" placeholder="按↓键提示输入" > <br>
			<input @keyup.left="showText" type="text" placeholder="按←键提示输入" > <br>
			<input @keyup.right="showText" type="text" placeholder="按→键提示输入" > <br>
			<input @keyup.a="showText" type="text" placeholder="按a键提示输入" > <br>
		</div>

		<script type="text/javascript">
			new Vue({
				el:'#demo',
				data:{
					school:'尚硅谷'
				},
				methods:{
					showText(e){
						console.log(e.target.value)
					}
				}
			})
		</script>
	</body>
</html>